<?php
/**
 * Created by PhpStorm.
 * User: 低调
 * Date: 2018/5/22
 * Time: 21:49
 */
include("../connectdb.php");
include("head.php");

//$result = mysqli_fetch_array(mysqli_query($conn,$sql))
//$conn=new mysqli('118.89.54.222','blogs','blogs','blogs');
//$conn->select_db('blogs');
$sql = "SELECT * FROM Admin";
$result=mysqli_query($conn,$sql);
$arr = array();
while($row=mysqli_fetch_array($result, MYSQLI_NUM)){
        $arr[]=$row;
}
?>
<!-- 内容区域 -->
<div class="tpl-content-wrapper">
    <div class="row-content am-cf">
        <div class="row">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                <div class="widget am-cf">
                    <div class="widget-head am-cf">
                        <div class="widget-title  am-cf">管理员用户列表</div>


                    </div>
                    <div class="widget-body  am-fr">

                        <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                            <div class="am-form-group">
                                <div class="am-btn-toolbar">
                                    <div class="am-btn-group am-btn-group-xs">
<!--                                        <button type="button" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</button>-->
<!--                                        <button type="button" class="am-btn am-btn-default am-btn-secondary"><span class="am-icon-save"></span> 保存</button>-->
<!--                                        <button type="button" class="am-btn am-btn-default am-btn-warning"><span class="am-icon-archive"></span> 审核</button>-->
<!--                                        <button type="button" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span> 删除</button>-->
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="am-u-sm-12">
                            <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                                <thead>
                                <tr>
                                    <th>Admin</th>
                                    <th>name</th>
                                    <th>邮箱</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>

                                <?php foreach($arr as $data):?>
                                    <tr class="gradeX">
                                        <td>
                                            <img src="assets/img/user.png" class="tpl-table-line-img" alt="">
                                        </td>
                                        <td><?php echo $data[3];?></td>
                                        <td><?php echo $data[1];?></td>
                                        <td><?php if($data[4]==2){echo "超级管理员";}elseif($data[4]==1){echo "普通管理员";}else{echo "已被禁用";}?></td>
                                        <td>
                                            <div class="tpl-table-black-operation">
                                                <?php if($data[4]==1)
                                                    echo"
                                                        <a href='common.php?id=$data[0]&kind=6'>
                                                        <i class='am-icon-pencil'></i> 禁用
                                                        </a>";
                                                elseif($data[4]==0)
                                                    echo "
                                                        <a href='common.php?id=$data[0]&kind=8'>
                                                        <i class='am-icon-archive'></i> 审核
                                                        </a>";
                                                ?>
                                                <?php if($data[4]<2)
                                                    echo"
                                                        <a href='common.php?id=$data[0]&kind=5' class=\"tpl-table-black-operation-del\">
                                                        <i class='am-icon-trash'></i> 删除
                                                        </a>";
                                                ?>
                                            </div>
                                        </td>
                                    </tr>
                                <?php endforeach;?>

                                </tbody>
                            </table>
                        </div>
                        <div class="am-u-lg-12 am-cf">

                            <div class="am-fr">
                                <ul class="am-pagination tpl-pagination">
                                    <li class="am-disabled"><a href="#">«</a></li>
                                    <li class="am-active"><a href="#">1</a></li>
                                    <li><a href="#">2</a></li>
                                    <li><a href="#">3</a></li>
                                    <li><a href="#">4</a></li>
                                    <li><a href="#">5</a></li>
                                    <li><a href="#">»</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
